import React from "react";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import PreAuditorHome from "../screens/preparationAuditor/PreAuditorHome";
import ArticleManage from "../screens/preparationAuditor/ArticleManage";
import AddArticle from "../screens/preparationAuditor/AddArticle";
import ArticlePreview from "../screens/preparationAuditor/ArticlePreview";
import { ArticleProvider } from "../context/preparation/ArticleContext";
import ArticleSelected from "../screens/preparationAuditor/ArticleSelected";
import EditArticle from "../screens/preparationAuditor/EditArticle";
import TestQuesManage from "../screens/preparationAuditor/TestQuesManage";
import AddTestQues from "../screens/preparationAuditor/AddTestQues";
import { TestQuesProvider } from "../context/preparation/TestQuesContext";
import EditTestQues from "../screens/preparationAuditor/EditTestQues";
import TestManage from "../screens/preparationAuditor/TestManage";
import { TestProvider } from "../context/preparation/TestContext";
import ScoreManage from "../screens/preparationAuditor/ScoreManage";
import { Feather } from "@expo/vector-icons";
import TestPreview from "../screens/preparationAuditor/TestPreview";
import AddQuesInTest from "../screens/preparationAuditor/AddQuesInTest";
import AddTest from "../screens/preparationAuditor/AddTest";
import TestSelected from "../screens/preparationAuditor/TestSelected";
import ArticleDetail from "../screens/preparationAuditor/ArticleDetail";
import ResearchManage from "../screens/preparationAuditor/ResearchManage";
import ResearchExamine from "../screens/preparationAuditor/ResearchExamine";
const Stack = createNativeStackNavigator();

const PreparationAuditorNavigation = ({ navigation }) => {
  return (
    <TestQuesProvider>
      <TestProvider>
        <ArticleProvider>
          <Stack.Navigator
            initialRouteName="Preparation"
            screenOptions={{
              headerTitleAlign: "center",
              headerTintColor: "#fff",
              headerStyle: {
                backgroundColor: "#A80108",
              },
            }}
          >
            <Stack.Screen
              name="PreAuditorHome"
              component={PreAuditorHome}
              options={{
                headerShown: true,
                title: "准备工作",
                headerLeft: () => (
                  <Feather
                    name="user"
                    style={{ padding: 5 }}
                    size={25}
                    color="#fff"
                    onPress={() => navigation.openDrawer()}
                  />
                ),
              }}
            />
            <Stack.Screen
              name="ArticleManage"
              component={ArticleManage}
              options={{
                headerShown: true,
                title: "文章管理",
              }}
            />
            <Stack.Screen
              name="AddArticle"
              component={AddArticle}
              options={{
                headerShown: true,
                title: "添加文章",
              }}
            />
            <Stack.Screen
              name="ArticleDetail"
              component={ArticleDetail}
              options={{
                headerShown: true,
                title: "文章详情",
              }}
            />
            <Stack.Screen
              name="ArticlePreview"
              component={ArticlePreview}
              // options={({ route }) => ({
              //   title: route.params.title,
              // })}
              options={{
                headerShown: true,
                title: "文章预览",
              }}
            />
            <Stack.Screen
              name="ArticleSelected"
              component={ArticleSelected}
              options={({ route }) => ({
                title: route.params.title,
              })}
            />
            <Stack.Screen
              name="EditArticle"
              component={EditArticle}
              options={{
                headerShown: true,
                title: "编辑文章",
              }}
            />
            <Stack.Screen
              name="TestQuesManage"
              component={TestQuesManage}
              options={{
                headerShown: true,
                title: "试题管理",
              }}
            />
            <Stack.Screen
              name="AddTestQues"
              component={AddTestQues}
              options={{
                headerShown: true,
                title: "创建试题",
              }}
            />
            <Stack.Screen
              name="EditTestQues"
              component={EditTestQues}
              options={{
                headerShown: true,
                title: "编辑试题",
              }}
            />
            <Stack.Screen
              name="TestManage"
              component={TestManage}
              options={{
                headerShown: true,
                title: "试卷管理",
              }}
            />
            <Stack.Screen
              name="ScoreManage"
              component={ScoreManage}
              options={{
                headerShown: true,
                title: "成绩查询",
              }}
            />
            <Stack.Screen
              name="TestPreview"
              component={TestPreview}
              options={{
                headerShown: true,
                title: "试卷内容",
              }}
            />
            <Stack.Screen
              name="AddQuesInTest"
              component={AddQuesInTest}
              options={{
                headerShown: true,
                title: "添加试卷题目",
              }}
            />
            <Stack.Screen
              name="AddTest"
              component={AddTest}
              options={{
                headerShown: true,
                title: "添加试卷",
              }}
            />
            <Stack.Screen
              name="TestSelected"
              component={TestSelected}
              options={{
                headerShown: true,
                title: "测试发布",
              }}
            />
            <Stack.Screen
              name="ResearchManage"
              component={ResearchManage}
              options={{
                headerShown: true,
                title: "调查报告审批",
              }}
            />
            <Stack.Screen
              name="ResearchExamine"
              component={ResearchExamine}
              options={{
                headerShown: true,
                title: "调查报告审批",
              }}
            />
          </Stack.Navigator>
        </ArticleProvider>
      </TestProvider>
    </TestQuesProvider>
  );
};

export default PreparationAuditorNavigation;
